<?php

class welcome extends Controller {
	public function index() {
		$this->session();
		$orgs = new organization();
		$public = $orgs->getPublicOrgs();
		foreach( $public as $org ) {
			$org_id = $org['org_id'];	
			$orgboxes[$org_id]['logo'] = $org['logo'];
			$orgboxes[$org_id]['name'] = $org['name'];
			$orgboxes[$org_id]['description'] = $org['description'];
			$orgboxes[$org_id]['long_description'] = $org['long_description'];
			$orgboxes[$org_id]['org_id'] = $org_id;
		}
		$content = new BufferedView('public/org', array( 'orgboxes' => $orgboxes, 'nonote' => true) );
		if($_SESSION['admin']===NULL) {
			new View('template', 
				array(
					'title' => 'FEELS',
					'heading' => 'Welcome to <span style="font-variant:normal;">F.E.E.L.S.</span>',
					'globalnav' => new BufferedView('org/globalnav'),
					'usernav' => '<span style="color:#fff; align:center"><h4><center>USER LOGIN</center></h4></span>'.new BufferedView('siteadmin/login',
								array(
									'action' => "/login/submit",
									'hiddenInputs' => array()
								)),
					'content' => $content
				)
			);	
		}
		else {
			new View('template', 
				array(
					'title' => 'FEELS',
					'heading' => 'Welcome to <span style="font-variant:normal;">F.E.E.L.S.</span>',
					'globalnav' => new BufferedView('org/globalnav'),
					'content' => $content
				)
			);
		}
	
	}
}
